#pragma once
#include <iostream>
#include <unistd.h>
#include <fcntl.h>

#include <cstring>
#include <errno.h>

void SetNoBlock(int fd)
{
    int fl = fcntl(fd, F_GETFL);
    if (fl < 0)
    {
        std::cerr << "fcntl :" << strerror(errno) << std::endl;
        return;
    }

    fcntl(fd, F_SETFL, O_NONBLOCK | fl); // 这里也可以和open一样设置其他标志位！
    return;
}

void printLog()
{
    std::cout << "this is a log" << std::endl;
}

void downLoad()
{
    std::cout << "this is a downLoad" << std::endl;
}

void executeSql()
{
    std::cout << "this is a executeSql" << std::endl;
}